package com.cjjd.c.feature.client;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;

import com.cjjd.c.R;
import com.cjjd.c.base.ActionBarFragment;
import com.cjjd.c.utils.FragmentUtil;
import com.cjjd.c.utils.ToastUtil;
import com.cjjd.c.view.CountDownTextView;
import com.youth.banner.Banner;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * ----------------------------------
 * Created by xyd on 2017/8/9.
 * <p/>
 * 描  述：
 * <p/>
 * 修订历史:
 * ----------------------------------
 */

public class HyxFragment extends ActionBarFragment {


    @Bind(R.id.banner)
    Banner banner;
    @Bind(R.id.btn_about)
    Button btnAbout;
    @Bind(R.id.btn_service)
    Button btnService;
    @Bind(R.id.btn_hot_phone)
    Button btnHotPhone;
    @Bind(R.id.ll_more_travel)
    LinearLayout llMoreTravel;
    @Bind(R.id.ll_more_special)
    LinearLayout llMoreSpecial;
    @Bind(R.id.cdtv_finish)
    CountDownTextView cdtvFinish;

    @Override
    public void initLeftButton(Button leftButton) {
        super.initLeftButton(leftButton);
        leftButton.setVisibility(View.GONE);
    }

    @Override
    public Object getTitleString() {
        return "会员享";
    }

    @Override
    public int getContentView() {
        return R.layout.fragment_hyx;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        ButterKnife.bind(this, rootView);
        initView();
        return rootView;
    }

    @Override
    protected void initView() {
        //super.initView();
        cdtvFinish.setText("66");
        cdtvFinish.setOnCountDownFinishedListener(new CountDownTextView.OnCountDownFinishedListener() {
            @Override
            public void onFinish() {
                Log.e("xyd","on finished");
            }
        });
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @OnClick({R.id.btn_about, R.id.btn_service, R.id.btn_hot_phone, R.id.ll_more_travel, R.id.ll_more_special})
    public void onViewClicked(View view) {
        switch (view.getId()) {

            case R.id.btn_about:
                FragmentUtil.replaceWithAddToBack(mContext, new AboutFragment(), R.id.activity_body);
                break;
            case R.id.btn_service:
                ToastUtil.showToast("功能暂未开通，敬请期待");

                break;
            case R.id.btn_hot_phone:
                ToastUtil.showToast("功能暂未开通，敬请期待");

                break;
            case R.id.ll_more_travel:
                ToastUtil.showToast("功能暂未开通，敬请期待");

                break;

            case R.id.ll_more_special:
                ToastUtil.showToast("功能暂未开通，敬请期待");

                break;
        }
    }
}
